/*    */ package com.zimbra.cs.datasource.imap;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.DataSource;
/*    */ import java.util.Collections;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ final class SyncStateManager
/*    */ {
/*    */   private final Map<String, SyncState> entries;
/* 29 */   private static final SyncStateManager INSTANCE = new SyncStateManager();
/*    */   
/*    */   public static SyncStateManager getInstance() {
/* 32 */     return INSTANCE;
/*    */   }
/*    */   
/*    */   private SyncStateManager() {
/* 36 */     this.entries = Collections.synchronizedMap(new HashMap());
/*    */   }
/*    */   
/*    */   public SyncState getSyncState(DataSource ds) {
/* 40 */     return (SyncState)this.entries.get(ds.getId());
/*    */   }
/*    */   
/*    */   public SyncState getOrCreateSyncState(DataSource ds) throws ServiceException {
/* 44 */     synchronized (this.entries) {
/* 45 */       SyncState ss = (SyncState)this.entries.get(ds.getId());
/* 46 */       if (ss == null) {
/* 47 */         ss = new SyncState(ds.getMailbox());
/* 48 */         this.entries.put(ds.getId(), ss);
/*    */       }
/* 50 */       return ss;
/*    */     }
/*    */   }
/*    */   
/*    */   public void removeSyncState(String dataSourceId) {
/* 55 */     this.entries.remove(dataSourceId);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/datasource/imap/SyncStateManager.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */